<?php
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.$module.'/common.inc.php';
$itemid or dheader($MOD['linkurl']);
$item = $db->getOne("SELECT * FROM {$table} WHERE itemid=$itemid");

//适用车品牌
$arbid=$item['arbid'];
if ($arbid) {
	$autoBrand = AutoBrand::get($arbid);
}
$arcid = $item['arcid'];
if ($arcid) {
	$autoCar = AutoCar::get($arcid);
}

//同类信息
$catid=$item['catid'];
$semesell=array();
$typesell = $db->getAll("SELECT * FROM {$table} WHERE catid=$catid");
foreach($typesell as $v=>$sll){
    $semesell[$v]['itemid']=$sll['itemid'];
    $semesell[$v]['title']=$sll['title'];
    $semesell[$v]['thumb']=$sll['thumb'];
    $semesell[$v]['linkurl']=$sll['linkurl'];
}

if($item && $item['status'] >= 2) {
	extract($item);
}else {
	$head_title = lang('message->item_not_exists');
	@header("HTTP/1.1 404 Not Found");
	exit(include template('show-notfound', 'message'));

}

$CAT = get_cat($catid);
if(!check_group($_groupid, $MOD['group_show']) || !check_group($_groupid, $CAT['group_show'])) {
	$head_title = lang('message->without_permission');
	exit(include template('noright', 'message'));
}
$content_table = content_table($moduleid, $itemid, $MOD['split'], $table_data);
$t = $db->getOne("SELECT content FROM {$content_table} WHERE itemid=$itemid");
$content = $t['content'];
if($MOD['keylink']) $content = keylink($content, $moduleid);

$adddate = timetodate($addtime, 3);
$editdate = timetodate($edittime, 3);
$todate = $totime ? timetodate($totime, 3) : 0;
$expired = $totime && $totime < $DT_TIME ? true : false;
$linkurl = linkurl($linkurl, 1);
$thumbs = get_albums($item);
$albums =  get_albums($item, 1);
$amount = number_format($amount, 0, '.', '');
$fee = get_fee($item['fee'], $MOD['fee_view']);
$update = '';
if(check_group($_groupid, $MOD['group_contact'])) {
    if($fee) {
        $user_status = 4;
    } else {
        $user_status = 3;
        $member = $item['username'] ? userinfo($item['username']) : array();
        if($item['totime'] && $item['totime'] < $DT_TIME && $item['status'] == 3) {
            $update .= ",status=4";
            $db->query("UPDATE {$table}_search SET status=4 WHERE itemid=$itemid");
        }


    }
} else {
    $user_status = $_userid ? 1 : 0;
    if($_username && $item['username'] == $_username) {
        $member = userinfo($item['username']);
        $user_status = 3;
    }
}

$user = userinfo($item['username']);
$userid=$user['userid'];
$member = $db->getOne("SELECT *FROM {$db->getPre()}member WHERE userid=$userid");


$group=PCache::read("grouporder.php");//读取缓存会员组排序
if(!$group){
	Xd_save_groupcachefile();
}

if ($CAT['catid']==6&&$modelid){
$auto_info = new AutoInfo();
$modelname=$auto_info->getAuto($modelid);
}

include DT_INC.'/update.inc.php';
$seo_file = 'show';
include DT_INC.'/seo.inc.php';
//$template = $item['template'] ? $item['template'] : ($CAT['show_template'] ? $CAT['show_template'] : 'show');
include template('show', $module);
?>